//package recyclerview;
//
//import android.content.Context;
//import android.os.Bundle;
//import android.support.annotation.Nullable;
//import android.support.v4.app.Fragment;
//import android.support.v4.widget.SwipeRefreshLayout;
//import android.support.v7.widget.RecyclerView;
//import android.text.TextUtils;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.view.ViewStub;
//import android.widget.TextView;
//
//import com.lib.recyclyeviewmodule.R;
//
//import recyclerview.view.LoadRecyclerView;
//import recyclerview.view.PullToRefreshRecyclerView;
//
//
///**
// * Created by Administrator on 2016/7/25.
// * 频道列表父类
// */
//
//public abstract class RecyclerViewListFm<T> extends Fragment implements SwipeRefreshLayout.OnRefreshListener,LoadRecyclerView.OnLoadingMore, MultTemplateAdapter.OnItemCLickListener {
//    public View mView;
//    public Context mContext;
//    public boolean isVisible;//是否可见
//    public boolean isInit;//是否初始化完成
//    public boolean isHasNightMode=true;
//    @BindView(R.id.PullToRefreshRecyclerView)
//    public PullToRefreshRecyclerView pullToRefreshRecyclerView;
//    @BindView(R.id.swipe_target)
//    public LoadRecyclerView mRecyclerView;
//    Unbinder bind;
//    public  HeadFootAdapter adapter;
////    public  LunBoManager lunBoManager;
//    public  View lunboView;
////    public  ChannelVo channelVo;
//    public TextView tv_second_title;
//    public ViewStub viewStub;
//    /**
//     * 懒加载
//     * @param isVisibleToUser
//     */
//    @Override
//    public void setUserVisibleHint(boolean isVisibleToUser) {
//        super.setUserVisibleHint(isVisibleToUser);
//        isVisible=isVisibleToUser;
//        lazyLoad();
//    }
//
//    public  void lazyLoad() {
//        if(isInit&&isVisible){
//            willRefresh();
//        }
//    }
//
//    public  void willRefresh(){
//        String lastTime = pullToRefreshRecyclerView.getLastCurrentTime(pullToRefreshRecyclerView.getUnique());
//        if(TextUtils.isEmpty(lastTime)){
//            autoRefresh();
//            return;
//        }
//        if (System.currentTimeMillis() - Long.parseLong(lastTime) > 10 * 60 * 1000) {
//            if (mRecyclerView != null) {
//                mRecyclerView.scrollToPosition(0);
//            }
//            autoRefresh();
//        }
//    }
//
//    /**
//     * 自动刷新
//     */
//    public  void autoRefresh() {
//        pullToRefreshRecyclerView.autoRefresh();
//    }
//
//
//    @Override
//    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
//        super.onViewCreated(view, savedInstanceState);
//        isInit=true;
//        lazyLoad();
//    }
//
//    @Override
//    public void onAttach(Context context) {
//        super.onAttach(context);
//        this.mContext=context;
//    }
//
//
//    @Override
//    public View onCreateView(LayoutInflater inflater,  ViewGroup container,  Bundle savedInstanceState) {
//        if (savedInstanceState != null) {
//            this.returnInstanceState(savedInstanceState);
//        }
//        mView=View.inflate(getActivity(), R.layout.fragment_recyclerview,null);
//        initView();
//        onCreateOk();
//        return mView;
//    }
//
//    private void initView() {
//        bind = ButterKnife.bind(this, mView);
//        pullToRefreshRecyclerView.setOnRefreshingListener(this);
//        pullToRefreshRecyclerView.setUnique(getUniqueLab());
//        mRecyclerView.setOnLoadingMore(this);
//        startStream();
//        RecyclerView.LayoutManager manager=getLayoutManager();
//        mRecyclerView.setLayoutManager(manager);
//        mRecyclerView.setLoadMore(true);
//        adapter=getAdapter();
////        lunBoManager= new LunBoManager(getActivity());
////        lunboView =lunBoManager.getLunboView();
////        lunBoManager.isVisibLunbo(false);
////        if(channelVo!=null){
////            if(channelVo.getUrl().contains("second")){
////                if(viewStub==null){
////                    viewStub = (ViewStub) lunboView.findViewById(R.id.viewstub);
////                    View inflate = viewStub.inflate();
////                    tv_second_title= (TextView) inflate.findViewById(R.id.tv_second);
////                }
////            }
//        }
//
//        adapter.addHeaderView(lunboView);
//        View iconView = getIconView();
//        if (iconView != null) adapter.addHeaderView(iconView);
//        mRecyclerView.setAdapter(adapter);
//        mRecyclerView.setItemViewCacheSize(0);
//    }
//
//
//
//    public void onCreateOk() {
//
//    }
//    protected abstract RecyclerView.LayoutManager getLayoutManager();
//
//    public abstract <T extends RecyclerView.Adapter> T getAdapter() ;
//    public void setUniqueLab(String unique){
//        pullToRefreshRecyclerView.setUnique(unique);
//    }
//    public abstract String getUniqueLab();
//
//    @Override
//    public void onRefresh() {
//
//    }
//
//    @Override
//    public void onLoadMore() {
//
//    }
//
//    /**
//     * 更新刷新时间
//     */
//    public void  setRefreshTime(){
//        pullToRefreshRecyclerView.setRefreshTime();
//    }
//
//    /**
//     * 结束刷新动作
//     */
//    public void  closeRefresh(){
//        pullToRefreshRecyclerView.closeRefresh();
//        mRecyclerView.closeLoadMore();
//    }
//
//    /**
//     * 缓存列表数据
//     * @param unique
//     * @param page
//     */
////    public void saveCache(String unique, int page, BaseBean bean){
////        JsonFileManager.saveJsonObject(getActivity(), unique+ "_" + page, bean);
////    }
//
//    /**
//     * 加载到最后一页数据
//     */
//    public void LoadMoreEnd(){
//        mRecyclerView.loadMoreEnd();
//    }
//    public void LoadMoreFail(int currentPage){
//        if(currentPage!=1){
//            mRecyclerView.loadMoreFail();
//        }
//    }
//
//    @Override
//    public void onItemClick(View view) {
//
//    }
//    public void startStream(){}
//    public void pauseStream(){}
//    public void resumeStream(){}
//    public void setActive(){}
//    public void videoStop(){}
//    public void fullToHalf(int position){}
//    public void isPauseVideo(boolean isPause){}
//    protected View getIconView(){return null;}
//    //    boolean isHasNight=true;
////    public void setIsNightType(boolean b){
////        this.isHasNight=b;
////    }
//    public void returnInstanceState(Bundle savedInstanceState) {
//
//    }
//    /**
//     * 点击回到顶部
//     */
//    public void toTop(){
//        mRecyclerView.smoothScrollToPosition(0);
//    }
//
////    public void setTag(ChannelVo channelVo) {
////        this.channelVo = channelVo;
////    }
//}
